<?php

use Illuminate\Support\Facades\Route;

/**
 * 物业后台 路由
 */

Route::namespace('Estate')->prefix('Estate')->group(function () {


    Route::post('/login', 'LoginController@login');            // 登陆
    Route::get('/logout', 'LoginController@logout');           // 退出账号
    Route::post('/register', 'LoginController@register');            //注册
    Route::get('/check_login', 'LoginController@check_login'); // 检测登陆
    Route::post('/paymentLog', 'PaymentLogController@index');//缴费记录
    Route::get('/get_community/{type?}', 'ElectricMeterController@get_community');//获取区域缴费计划等数组
    Route::get('/get_agent', 'CollectorMeterController@get_agent');//获取区域缴费计划等数组
    Route::get('/get_electric_list', 'ElectricMeterController@get_electric_list');//获取父级表
    // 保电拉合闸
    Route::apiResource('control', 'ElectricController')->only(['index', 'show', 'store']);
    Route::post('/edit_goods_status', 'GoodsController@edit_goods_show_status');//商品上下架状态修改
    Route::group(['middleware' => 'jwt.estate'], function () {
        Route::get('menus_list', 'MenuController@list'); // 用户菜单
        Route::apiResources([
            'estates' => 'EstateController', // 超级管理员
            'users' => 'UserController', // 平台用户
            'roles' => 'RoleController', // 用户角色
            'menus' => 'MenuController', // 用户菜单
            'permissions' => 'PermissionController', // 角色权限
            'permission_groups' => 'PermissionGroupController', // 接口权限分组
            'house' => 'HouseController', // 楼栋管理
            'element' => 'ElementController', // 楼栋管理
            'room' => 'RoomController', // 楼栋管理
            'complain' => 'ComplainController', // 投诉管理
            'maintain' => 'MaintainController', // 维修管理
            'stores_cate' => 'StoresCateController', // 商家
            'electric_meter' => 'ElectricMeterController', // 电表设备
            'water_meter' => 'WaterMeterController', // 水表设备
            'collector_meter' => 'CollectorMeterController', // 采集器设备
        ]);
        // 公告管理
        Route::apiResource('announcement', 'AnnouncementController');
        //获取小区的所有楼栋
        Route::get('allHouse/{id}', 'HouseController@getAllHouseByCommunity');
        //获取楼栋的所有单元
        Route::get('allElement/{id}', 'HouseController@getAllElementByHouse');
        //获取单元的所有楼层
        Route::get('allFloor/{id}', 'HouseController@getAllFloorByElement');

        //修改用户信息
        Route::post('/users/change_info', 'UserController@changeInfo');

        // 菜单处理
        Route::get('/menus/clear_cache', 'MenuController@clear_cache'); // 缓存清除接口


        Route::apiResource('agreements', 'AgreementController');                                 // 站点协议
        Route::apiResource('articles', 'ArticleController');                                     // 文章，帮助中心


        // 编辑器上传图片接口
        Route::post('/editor/upload', 'EditorController@editor')->name('public.editor');         // 富文本编辑器图上传

        // 短信管理
        Route::apiResource('sms_logs', 'SmsLogController')->except(['update', 'show', 'store']); // 短信日志
        Route::apiResource('sms_signs', 'SmsSignController');                                    // 短信签名

        // 商品分类
        Route::apiResource('goods_classes', 'GoodsClassController');
        Route::post('/goods_classes/upload/thumb', 'GoodsClassController@goods_class_upload')->name('goods_classes.goods_class_upload'); // 缩略图上传
        Route::get('/goods_classes/cache/clear', 'GoodsClassController@clear_cache')->name('goods_classes.clear_cache');                 // 缓存清除商品分类
        Route::post('/edit_goods_cate_status', 'GoodsClassController@edit_goods_cate_show_status');//商品分类状态修改
//        Route::post('/edit_goods_status', 'GoodsController@edit_goods_show_status');//商品上下架状态修改
        // 店铺管理
        Route::apiResource('stores', 'StoreController')->except(['store']);

        // 全国省市区地址
        Route::apiResource('areas', 'AreaController');
        Route::get('/areas/cache/clear', 'AreaController@clear_cache')->name('areas.clear_cache'); // 缓存清除行政地址

        // 商品品牌
        Route::apiResource('goods_brands', 'GoodsBrandController');
        Route::post('/goods_brands/upload/thumb', 'GoodsBrandController@goods_brand_upload')->name('goods_brands.goods_brand_upload'); // 品牌缩略图上传

        // 商品管理
        Route::apiResource('goods', 'GoodsController')->except(['store']);

        // 广告位管理
        Route::apiResource('adv_positions', 'AdvPositionController');
        Route::apiResource('advs', 'AdvController');
        Route::post('/advs/upload/thumb', 'AdvController@adv_upload')->name('advs.adv_upload');                                    // 缩略图上传

        // 订单管理
        Route::apiResource('orders', 'OrderController')->except(['store']);
        //抢单路由
        Route::post('grabOrder', 'GrabController@grabOrder');
        Route::post('grabOrderList', 'GrabController@grabOrderList');
        Route::post('grabOrderChange', 'GrabController@grabOrderStatusChenge');

        // 订单评论
        Route::apiResource('order_comments', 'OrderCommentController')->except(['store', 'update']);


        // 结算日志
        Route::apiResource('order_settlements', 'OrderSettlementController')->except(['update', 'destroy']);

        // 资金日志
        Route::apiResource('money_logs', 'MoneyLogController')->only(['index']);

        // 资金提现
        Route::apiResource('cashes', 'CashController')->except(['destroy', 'show']);

        // 积分管理
        Route::apiResource('integral_set', 'IntegralSetController'); //列表
        Route::post('integral_set_edit_state', 'IntegralSetController@integral_set_edit_state');//修改设置状态
        Route::apiResource('integral_log', 'IntegralLogController'); //领取日志
        // 数据统计
        Route::get('/statistics/all', 'StatisticController@all')->name('statistics.all');                                          // 所有
        Route::get('/statistics/user', 'StatisticController@user')->name('statistics.user');                                       // 用户
        Route::get('/statistics/store', 'StatisticController@store')->name('statistics.store');                                    // 店铺
        Route::get('/statistics/order', 'StatisticController@order')->name('statistics.order');                                    // 订单
        Route::get('/statistics/pay', 'StatisticController@pay')->name('statistics.pay');                                          // 支付

        //运营管理
        Route::apiResource('home_banner', 'HomeBannerController');                                                                //首页轮播图管理
        Route::post('/edit_show_status', 'HomeBannerController@edit_show_status')->name('editShowStatus');                        //修改启用状态

        Route::apiResource('notice', 'NoticeController');                               //公告管理
        Route::post('edit_notice_show', 'NoticeController@edit_show')->name('editShow');//修改启用状态

        Route::get('/area_lists', 'CommunityController@area_lists')->name('area_lists');

        Route::apiResource('resources', 'ResourcesController');                               //资源位管理
        Route::post('edit_resources_show', 'ResourcesController@edit_show')->name('editShow');//修改启用状态

        Route::apiResource('house_cate', 'HouseCateController');                               //家政分类
        Route::get('house_cate_list', 'HouseCateController@cate_list')->name('house_cate_list');                  //家政分类列表
        Route::post('edit_house_cate_show', 'HouseCateController@edit_show')->name('editShow');//修改启用状态

        Route::apiResource('house_info', 'HouseInfoController');                               //家政信息
        Route::post('edit_house_info_show', 'HouseInfoController@edit_show')->name('editShow');//修改启用状态

        Route::apiResource('tutor_info', 'TutorInfoController');                               //家教信息
        Route::post('edit_tutor_info_show', 'TutorInfoController@edit_show')->name('editShow');//修改启用状态

        Route::apiResource('remover_info', 'RemoverInfoController');                               //搬家公司信息
        Route::post('edit_remover_info_show', 'RemoverInfoController@edit_show')->name('editShow');//修改启用状态

        Route::apiResource('recovery_info', 'RecoveryInfoController');                               //回收站信息
        Route::post('edit_recovery_info_show', 'RecoveryInfoController@edit_show')->name('editShow');//修改启用状态

        //邻里圈
        //邻里圈说说管理
        Route::get('circle', 'CircleController@index');
        //删除邻里圈
        Route::delete('circle/{id}', 'CircleController@destroy');
        //获取所有的标签
        Route::get('getLabel', 'CircleController@getLabel');
        //获取动态下的所有评论
        Route::get('getCircle/{id}', 'CircleController@getCircleComment');
        //邻里圈管理  -- 房源出租
        Route::apiResource('houseLease', 'HouseLeaseController');
        //邻里圈管理  -- 房源出售
        Route::apiResource('houseSell', 'HouseSellController');
        Route::post('editHouseSellState', 'HouseSellController@editHouseSellState');

        //跳蚤订单
        Route::apiResource('fleaOrder', 'FleaOrderController');

        //跳蚤市场
        Route::apiResource('flea_banner', 'FleaBannerController');                                        //首页轮播图管理
        Route::post('/edit_flea_status', 'FleaBannerController@edit_show_status')->name('editShowStatus');//修改启用状态

        Route::apiResource('flea_goods', 'FleaGoodsController');                                        //闲置商品列表

        /**
         * 能源运维
         */
        //代理商列表
        Route::apiResource('electricPlatformAgent', 'ElectricPlatformAgentController');
        //禁用启用代理商
        Route::get('statusPlatformAgent', 'ElectricPlatformAgentController@status');
        //视频资源列表
        Route::apiResource('monitor', 'MonitorController');
        Route::post('PropertyShow', 'PropertyController@edit');
        Route::post('PropertyUpdate', 'PropertyController@update');
        Route::get('statusMonitor', 'MonitorController@status');

        //电表报警记录
        Route::get('alarmRecord', 'AlarmRecordController@index');
        // 小区管理
        Route::get('/community', 'CommunityController@index');
        Route::post('/edit_community_status', 'CommunityController@edit_status')->name('editCommunityStatus');
        Route::get('/community_del', 'CommunityController@del_status')->name('editCommunityDelStatus');                    //  删除状态


        // 业主管理
        Route::get('/platform_owner', 'PlatformOwnerController@index');
        Route::get('/platform_owner/estatePlaformownerInof/{id}', 'PlatformOwnerController@estatePlaformownerInof');
        Route::post('/platform_owner/estatePlaformownerEdit', 'PlatformOwnerController@estatePlaformownerInof');

        Route::post('platform_owner/editPlaformownerStatus', 'PlatformOwnerController@editPlaformownerStatus');
        Route::get('platform_owner/editPlatformOwnerDel/{id}', 'PlatformOwnerController@editPlatformOwnerDel');

        Route::get('/platform_owner/getchargingScheme', 'PlatformOwnerController@getchargingScheme');
        Route::get('/platform_owner/getCommunity', 'PlatformOwnerController@getCommunity');
        Route::get('/platform_owner/communityAreaList/{id}', 'PlatformOwnerController@communityAreaList');
        Route::get('/platform_owner/communityTowerList/{id}', 'PlatformOwnerController@communityTowerList');
        Route::get('/platform_owner/communityElementList/{id}', 'PlatformOwnerController@communityElementList');
        Route::get('/platform_owner/communityFloorList/{id}', 'PlatformOwnerController@communityFloorList');
        Route::get('/platform_owner/communityRoomList/{id}', 'PlatformOwnerController@communityRoomList');

        //电表抄读记录
        Route::get('/MeterSettlement', 'MeterSettlementController@index');
        //财务账单
        Route::get('/Accounts', 'AccountsController@index');
        //缴费记录
        Route::get('/PaymentOrder', 'PaymentOrderController@index');
        //財務統計
        Route::get('/FinanceIndex', 'FinanceIndexController@index');

        //电量统计
        Route::get('eleStatistics', 'ElectricStatisticsController@eleStatistics');
        //电表详情页
        Route::get('electricTimeData/{id}', 'ElectricMeterController@electricTimeData');
        Route::get('electricDetail/{id}', 'ElectricMeterController@electricDetail');
        Route::get('electricTimeData/{id}/{community}/{tableAddress}/{code}', 'ElectricMeterController@electricTimeData');
        Route::get('dataReport', 'ElectricMeterController@dataReport');
        Route::get('eleReport', 'ElectricMeterController@eleReport');
        Route::get('realTimeData', 'ElectricMeterController@getRealTimeData');
        //获取代理商等级列表
        Route::get('agentLevel', 'ElectricPlatformAgentController@agentLevel');
        //代理商参数
        Route::get('option', 'ElectricPlatformAgentController@option');

        //巡查员
        Route::apiResource('electricVisitator', 'ElectricVisitatorController');
        //状态
        Route::get('electricVisitatorStatus', 'ElectricVisitatorController@status');

        //开户行
        Route::apiResource('electricAccountBank', 'ElectricAccountBankController');
        //状态
        Route::get('electricAccountBankStatus', 'ElectricAccountBankController@status');

        //代理商等级
        Route::apiResource('electricAgentLevel', 'ElectricAgentLevelController');
        //状态
        Route::get('electricAgentLevelStatus', 'ElectricAgentLevelController@status');

        //分账记录
        Route::get('electricAccountingRecords', 'ElectricAccountingRecordsController@index');
        //审核
        Route::post('electricAccountingRecordsStatus', 'ElectricAccountingRecordsController@status');

        //阀控记录
        Route::get('electricValveControlLog', 'ElectricValveControlLogController@index');
        //电表订单
        Route::get('electricityBill', 'ElectricityBillController@index');
        //水表订单
        Route::get('waterBill', 'WaterBillController@index');
        //获取省市区
        Route::get('region', 'ElectricPlatformAgentController@region');

        //用户报警模板
        Route::get('AlarmPlan', 'AlarmPlanController@index');
        Route::get('AlarmPlan/EditAlarmPlan/{id}', 'AlarmPlanController@EditAlarmPlan');
        Route::post('AlarmPlan/EditAlarmPlanInfo', 'AlarmPlanController@EditAlarmPlan');
        Route::post('AlarmPlan/editAlarmPlanStatus', 'AlarmPlanController@editAlarmPlanStatus');          Route::DELETE('AlarmPlan/editAlarmPlanDel/{id}', 'AlarmPlanController@editAlarmPlanDel');

        //收费模板
        Route::get('ChargingScheme', 'ChargingSchemeController@index');
        Route::get('ChargingScheme/EditChargingScheme/{id}', 'ChargingSchemeController@EditChargingScheme');
        Route::post('ChargingScheme/EditChargingSchemeInfo', 'ChargingSchemeController@EditChargingScheme');
        Route::post('ChargingScheme/editChargingSchemeStatus', 'ChargingSchemeController@editChargingSchemeStatus');
        Route::get('ChargingScheme/editChargingSchemeDel/{id}', 'ChargingSchemeController@editChargingSchemeDel');

        // 区域管理
        Route::get('/ElectricCommunity', 'ElectricCommunityController@index');
        Route::get('/ElectricCommunity/EditElectricCommunity/{id}', 'ElectricCommunityController@EditElectricCommunity');
        Route::POST('/ElectricCommunity/ElectricLineLoss', 'ElectricCommunityController@ElectricLineLoss');
        Route::post('ElectricCommunity/doEditElectricCommunity', 'ElectricCommunityController@EditElectricCommunity');
        Route::post('ElectricCommunity/editElectricCommunityStatus', 'ElectricCommunityController@editElectricCommunityStatus');
        Route::DELETE('/ElectricCommunity/delElectricCommunity/{id}', 'ElectricCommunityController@delElectricCommunity');

        Route::get('/getAgent', 'ElectricCommunityController@getAgent');
        Route::get('/sys_region', 'ElectricCommunityController@sys_region');//三级联动
        //水表详情页
        Route::get('waterTimeData/{id}', 'WaterMeterController@waterTimeData');
        Route::get('waterDetail/{id}', 'WaterMeterController@waterDetail');
        Route::get('waterTimeData/{id}/{community}/{tableAddress}/{code}', 'WaterMeterController@waterTimeData');
        Route::get('waterDataReport', 'WaterMeterController@waterDataReport');
        Route::get('waterReport', 'WaterMeterController@waterReport');
        //设备层级
        Route::apiResource('equipmentLevel', 'EquipmentLevelController');
        Route::get('meterChangeLog', 'ElectricMeterController@changeLog');
    });


});

